import request from '@/utils/request'
// 获取分类列表
export const getCategories = (params) => {
  return request({
    url: '/categories',
    params
  })
}
// 获取指定分类
export const getCategoriesById = (id) => {
  return request({
    url: '/categories/' + id
  })
}

// 编辑分类
export const editCategories = (data) => {
  return request({
    url: '/categories/' + data.id,
    method: 'put',
    data
  })
}
// 新增分类
export const addCategoties = (data) => {
  return request({
    url: '/categories',
    method: 'post',
    data
  })
}

// 获取总数
export const numCategoties = (params) => {
  return request({
    url: '/categories/count',
    params
  })
}

// 删除
export const delCategoties = (id) => {
  return request({
    url: '/categories/' + id,
    method: 'delete'
  })
}
